
#include "fiber-context.h"

#include "interlocked.h"

namespace dulymoo {

unsigned long FiberContext::next_id_ = 0;

FiberContext::FiberContext(void (*func)(void*), void* arg, unsigned long stack_size, const char* name) :
    id_(interlocked::Increment(reinterpret_cast<long*>(&next_id_))),
    name_(name != NULL ? name : ""),
    fiber_(func, arg, stack_size)
{
}

void FiberContext::SetState(const char* state)
{
    state_ = state;
}

} // namespace dulymoo

